package ControlLayer;

import java.util.ArrayList;

import ModelLayer.RealException;
import ModelLayer.SaleItem;
import ModelLayer.SaleItemRecords;

public class SaleItemCtr {

	private SaleItemRecords saleItemRecords;
	
	public SaleItemCtr() {
		saleItemRecords = SaleItemRecords.getInstance();
	}
	
	public void createSaleItem(String name, int location, double bPrice, double sPrice, double tax,
	String um, int minStock, int maxStock, int currStock, int discountQ, int contractorID) throws RealException {
		saleItemRecords.createSaleItem(name, location, bPrice, sPrice, tax, um, minStock,
				maxStock, currStock, discountQ, contractorID);
	}
	
	public SaleItem getSaleItem(String barcode) throws RealException {
		return saleItemRecords.getSaleItem(barcode);
	}
	
	public void checkSaleItem(String barcode) throws RealException {
		saleItemRecords.checkSaleItem(barcode);
	}
	
	public void updateSaleItem(String barcode, int fieldID, String value ) throws RealException {
		saleItemRecords.updateSaleItem(barcode, fieldID, value);
	}

	public void deleteSaleItem(String barcode) throws RealException {
		saleItemRecords.deleteSaleItem(barcode);
	}
	
	public String getSaleItemInfo(String barcode) throws RealException {
		return saleItemRecords.getSaleItemInfo(barcode);
	}
	
	public ArrayList<String> getAllSaleItemInfo() {
		return saleItemRecords.getAllSaleItemInfo();
	}
	
	public ArrayList<String> findSaleItem(String searchPattern) throws RealException {
		return saleItemRecords.findSaleItems(searchPattern);
	}
}
